package nsu.grandfinal;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.widget.TabHost;

public class ClaTabHost {
	Context	context;
	TabHost	tabHost;
	
	public ClaTabHost(Context context, TabHost tabHost) {
		this.context = context;
		this.tabHost = tabHost;
		this.tabHost.setup();
	}
	
	public TabHost GetOvject() {
		return this.tabHost;
	}
	
	public void AddLayout(int resource) {
		LayoutInflater.from(context).inflate(resource, tabHost.getTabContentView(), true);
	}
	
	public void AddTab(String strID, String strTitle, int intTabIcon, int intContentViewId, Context context, Class<?> cls) {
		TabHost.TabSpec spec;
		spec = tabHost.newTabSpec(strID);
		Drawable drawTabIcon;
		if (intTabIcon < 0) {
			drawTabIcon = null;
		} else {
			drawTabIcon = this.context.getResources().getDrawable(intTabIcon);
		}
		spec.setIndicator(strTitle, drawTabIcon);
		spec.setContent(intContentViewId);
		spec.setContent(new Intent(context, cls));
		tabHost.addTab(spec);
	}
}